import request from '@/utils/request'
import type { APIResponse, CheckItem, CheckItemType } from '@/types/api'

// 获取检查项目类型列表
export function getCheckItemTypeList(parentId?: number) {
  return request<APIResponse<CheckItemType[]>>({
    url: '/api/OrderRecordGetCheckItemTypeList',
    method: 'GET',
    params: { parentId }
  })
}

// 获取检查项目列表
export function getCheckItemList(typeId?: number) {
  return request<APIResponse<CheckItem[]>>({
    url: '/api/OrderRecordGetCheckItemList',
    method: 'GET',
    params: { typeId }
  })
}

// 获取已选项目的详细信息
export function getSelectedItemsDetail(selectedItemIds: number[]) {
  return request<APIResponse<any[]>>({
    url: '/api/OrderRecordGetSelectedItemsDetail',
    method: 'POST',
    data: selectedItemIds
  })
}

// 计算已选项目的总价
export function calculateOrderSummary(selectedItems: any[]) {
  return request<APIResponse<any>>({
    url: '/api/OrderRecordCalculateOrderSummary',
    method: 'POST',
    data: selectedItems
  })
}